﻿<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
    CodeFile="AssetCost.aspx.vb" Inherits="WebForm_AssetCost" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:HiddenField ID="hiUID" runat="server" />
            <asp:HiddenField ID="hiDBName" runat="server" />
            <asp:ObjectDataSource ID="dbModelPrice" runat="server" 
                SelectMethod="GetAssetCost" TypeName="AssetManage.BBL.ModelPriceBBL" 
                InsertMethod="InsertAssetcost" UpdateMethod="UpdateAssetcost" 
                DeleteMethod="DeleteAssetcost">
                <DeleteParameters>
                    <asp:Parameter Name="Model" Type="String" />
                    <asp:Parameter ConvertEmptyStringToNull="False" Name="FactoryID"   DefaultValue =""
                        Type="String" />
                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" 
                        Type="String" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Model" Type="String" />
                     <asp:Parameter ConvertEmptyStringToNull="False" Name="FactoryID"   DefaultValue =""
                        Type="String" />
                    <asp:Parameter Name="Price" Type="Double" />
                    <asp:Parameter Name="Description" Type="String"  ConvertEmptyStringToNull ="false" DefaultValue =""/>
                    <asp:ControlParameter ControlID="hiUID" Name="UID" PropertyName="Value" 
                        Type="String" />
                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" 
                        Type="String" />
                </UpdateParameters>
                <SelectParameters>
                    <asp:ControlParameter ControlID="txtModel" ConvertEmptyStringToNull="False" 
                        Name="Model" PropertyName="Text" Type="String"  DefaultValue =""/>
                        <asp:Parameter ConvertEmptyStringToNull="False" Name="FactoryID"   DefaultValue =""
                        Type="String" />
                    <asp:ControlParameter ControlID="txtDescription" 
                        ConvertEmptyStringToNull="False" Name="Descprition" PropertyName="Text" 
                        Type="String" DefaultValue =""/>
                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" 
                        Type="String" />
                </SelectParameters>
                <InsertParameters>
                    <asp:ControlParameter ControlID="txtModelIns" Name="Model" PropertyName="Text"  ConvertEmptyStringToNull="False" 
                        Type="String" />
                    <asp:Parameter ConvertEmptyStringToNull="False" Name="FactoryID"   DefaultValue =""
                        Type="String" />
                    <asp:ControlParameter ControlID="txtPriceIns" Name="Price" PropertyName="Text"  ConvertEmptyStringToNull="False" 
                        Type="Double" />
                        <asp:ControlParameter ControlID="txtDescriptionIns" Name="Description" PropertyName="Text" ConvertEmptyStringToNull="False" DefaultValue =""
                        Type="String" />
                    <asp:ControlParameter ControlID="hiUID" Name="UID" PropertyName="Value" 
                        Type="String" />
                    <asp:ControlParameter ControlID="hiDBName" Name="dbName" PropertyName="Value" 
                        Type="String" />
                </InsertParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="dbOAFactory" runat="server" 
                SelectMethod="GetOAFactory" TypeName="AssetManage.BBL.AssetBBL">
                <SelectParameters>
                    <asp:Parameter DefaultValue="0" Name="kind" Type="String" />
                    <asp:ControlParameter ControlID="hiDBName" DefaultValue="" Name="dbName" 
                        PropertyName="Value" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <table border="1" width="900px">
                <tr>
                    <td style="text-align: center" colspan="6">
                        <asp:Label ID="lblTitle" runat="server" meta:resourcekey="lblTitle" Font-Bold="True" Font-Size="24px"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblFactory" runat="server" meta:resourcekey="lblFactory" 
                            Visible="False" ></asp:Label>
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlFactory"  DataTextField="name"
                            DataValueField="id" DataSourceID="dbOAFactory" AutoPostBack="True" 
                            Visible="False">
                        </asp:DropDownList>
                    </td>
                    <td style="text-align: right">
                       <asp:Label ID="lblModel" runat="server" meta:resourcekey="lblModel" ></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtModel" runat="server"></asp:TextBox>
                    </td>
                    <td style="text-align: right">
                       <asp:Label ID="lblDesc" runat="server" meta:resourcekey="lblDesc" ></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtDescription" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: center" colspan="6">
                        <asp:Button ID="btnQuery" runat="server" meta:resourcekey="btnQuery" />
                        <asp:Button ID="btnInsert" runat="server" meta:resourcekey="btnInsert" />
                    </td>
                </tr>
                <tr style="vertical-align: text-top">
                    <td colspan="6">
                        <asp:Panel ID="plInsert" runat="server" BackColor="#E7FEC2" Height="100px" 
                            Width="800px">
                            <table border="1">
                                <tr>
                                    <td align="right">
                                       <asp:Label ID="Label1" runat="server" meta:resourcekey="lblFactory" 
                                            Visible="False" ></asp:Label>
                                    </td>
                                    <td>
                                        <asp:DropDownList runat="server" ID="ddlOAFactoryIns" DataTextField="name" DataValueField="id"
                                            DataSourceID="dbOAFactory" Visible="False">
                                        </asp:DropDownList>
                                    </td>
                                    <td style="text-align: right">
                                       <asp:Label ID="Label2" runat="server" meta:resourcekey="lblModel" ></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtModelIns" runat="server"></asp:TextBox>
                                    </td>
                                    <td style="text-align: right">
                                      <asp:Label ID="Label3" runat="server" meta:resourcekey="lblPrice" ></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtPriceIns" runat="server"></asp:TextBox>
                                    </td>
                                    <td style="text-align: right">
                                        <asp:Label ID="Label4" runat="server" meta:resourcekey="lblDesc" ></asp:Label> 
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtDescriptionIns" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="8">
                                        <asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" />
                                        <asp:Button ID="btnCancel" runat="server" meta:resourcekey="btnCancel" />
                                    </td>
                                </tr>
                            </table>
                            <br />
                        </asp:Panel>
                        
                        <ajaxToolkit:ModalPopupExtender ID="mpIns" runat="server" 
                            PopupControlID="plInsert" TargetControlID ="btnInsert" PopupDragHandleControlID="plInsert"
                            CancelControlID="btnCancel" X="20" Y="50" BehaviorID="mpIns">
                        </ajaxToolkit:ModalPopupExtender>
                        
                        <TServerControl:TGridView ID="gvModelPrice" runat="server" AllowHoverEffect="False"
                            AllowHoverSelect="False" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="dbModelPrice"
                            ShowFooterWhenEmpty="False" ShowHeaderWhenEmpty="True" SkinID="pager" TotalRowCount="0"
                            Width="900px" DataKeyNames="Model">
                            <Columns>
                                <asp:TemplateField >
                                    <EditItemTemplate>
                                        <asp:LinkButton ID="btnUpdate"  CommandName="Update" runat="server" meta:resourcekey="btnUpdate"></asp:LinkButton>
                                        <asp:LinkButton ID="btnCancel" CommandName="Cancel" runat="server" meta:resourcekey="btnCancel"></asp:LinkButton>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnEdit" CommandName ="Edit" runat="server" meta:resourcekey="btnEdit"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnDelete"  CommandName ="Delete"  runat="server" meta:resourcekey="btnDelete"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Model"  ReadOnly ="true" meta:resourcekey="colModel"/>
                                <asp:BoundField  ItemStyle-HorizontalAlign="Right"  meta:resourcekey="colPrice"
                                    DataField="Price" >
                                  
                                    <ItemStyle HorizontalAlign="Right" />
                                </asp:BoundField>
                                  
                                <asp:BoundField meta:resourcekey="colDesc"  DataField="Description" />
                               
                                <asp:BoundField meta:resourcekey="colCrtName" DataField="CrtName" ReadOnly="True"/>
                                <asp:BoundField meta:resourcekey="colCrtDate"  DataField="CrtDate1" ReadOnly="True" />
                                <asp:BoundField meta:resourcekey="colModiName"  DataField="ModiName" ReadOnly="True"/>
                                <asp:BoundField  meta:resourcekey="colModiDate"   DataField="ModiDate1" ReadOnly="True"/>
                            </Columns>
                            <EmptyDataTemplate>
                                <asp:Label ID="lblEmpty" runat="server" ForeColor="Red"></asp:Label>
                            </EmptyDataTemplate>
                        </TServerControl:TGridView>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
